package com.own.business.question.entity.bo;

import com.own.business.question.entity.po.QuestionOption;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * QuestionOptionBo
 *
 * @author 陈学礼 （你是一段成熟的代码，要学会自己改bug）
 * @version 4.0.0
 * @date 2021/05/14 09:41:05
 * @since 4.0.0
 */
@Schema(description = "题目选项" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class QuestionOptionBo extends BaseBo<QuestionOption> {

    @Schema(description = "题目id")
    private Long questionId;

    @Schema(description = "文字内容")
    private String content;

    @Schema(description = "图片文件id")
    private String image;

    @Schema(description = "选择题的时候是否为正确的答案 1-是 0不是")
    private Integer isAnswer;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public QuestionOption toPo(QuestionOption entity) {
        if (entity == null) {
            entity = new QuestionOption();
        }
        entity.setFkQuestionId(questionId);
        entity.setContent(content);
        entity.setImage(image);
        entity.setIsAnswer(isAnswer);
        return super.toPo(entity);
    }

}
